package models;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.OrderBy;


@Entity
@DiscriminatorValue(value="1")
public class Admin extends Owner {
	
	@ManyToMany(cascade = CascadeType.ALL, fetch=FetchType.LAZY)
	@JoinTable(name = "Admin_FoodCourt", joinColumns = @JoinColumn(name = "admin_id"), inverseJoinColumns = @JoinColumn(name = "place_id"))
	@OrderBy("name")
	private Set<FoodCourt> foodCourts;

	public Set<FoodCourt> getFoodCourts() {
		return foodCourts;
	}

	public void setFoodCourts(Set<FoodCourt> foodCourts) {
		this.foodCourts = foodCourts;
	}
	
	@Override
	public boolean isAdmin() {
		return true;
	}
}
